<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<#include "../../base/_meta.html"> 
<@head>
<script type="text/javascript">
	var eee;
	var dialog = frameElement.dialog;
	$(function() {		
		$.metadata.setType("attr", "validate");
        var v = $("form").validate({
            debug: true
        });
        $("form").ligerForm();
	});
	// Save
	function doSave(){
		var form = liger.get('form_edit');
        if (!form.valid()) {
       	 return;
        }
		$.ajax({
			url:"/ddesign/project/save",
			data:$("#form_edit").serialize(),
			success:function(msg){
	        	if(msg == "1"){
	        		parent.window.doSearch();// Rfresh grid of users
	        		$.ligerDialog.confirm('保存成功，继续添加或修改数据？', 
	        				function (yes) {
	        				if(yes){
	        					if($("#screen").val()=="A"){
	        						$("#projectcode").val("");
	        					}
	        				}else{
	        					dialog.close();
	        				}
	        			});
	        		
	        	}else{
	        		$.ligerDialog.error(msg); 
	        	}
	    	}
		});	
	}
</script>
<style type="text/css">
 body{ font-size:12px;}
 .l-table-edit {}
 .l-table-edit-td{ padding:4px;}
 .l-button-submit,.l-button-test{width:60px; float:center; margin-left:10px; padding-bottom:2px;}
 .l-verify-tip{ left:230px; top:120px;}
</style>
</@head>
<body style="overflow-x: hidden; padding: 2px;">
<form id="form_edit" class="liger-form" data-validate="{}">
	<input type="hidden" name="screen" id="screen" value="${(screen)!}"/>
	<table cellpadding="0" cellspacing="0" class="l-table-edit" >
		<tr>
			<td align="right" class="l-table-edit-td">编号:</td>
			<td align="left" class="l-table-edit-td" style="width: 160px">
			<#if screen == "A">
			<input
				name="projectcode" type="text" id="projectcode" ltype="text"
				validate="{required:true,minlength:3,maxlength:100}"/>
			</#if>
			<#if screen == "E">
			<input
				name="projectcode" type="text" id="projectcode" ltype="text" readonly="readonly"
				value="${(pro.projectcode)!}"
				validate="{required:true,minlength:3,maxlength:100}"/>
			</#if>
				
			</td>
			<td align="left"></td>
		</tr>
		<tr>
			<td align="right" class="l-table-edit-td">项目名:</td>
			<td align="left" class="l-table-edit-td" style="width: 160px"><input
				name="projectname" type="text" id="projectname" ltype="text" value="${(pro.projectname)!}"
				validate="{required:true,minlength:3,maxlength:100}"/>	
			</td>
			<td align="left"></td>
		</tr>
        <tr>
           <td align="right" class="l-table-edit-td">备注描述:</td>
           <td align="left" class="l-table-edit-td" colspan="2" > 
           <textarea name="remark" id="remark" cols="40" rows="7" 
           			class="l-textarea"  style="width:400px">${(pro.remark)!}</textarea>
           </td> <td align="left"></td>
       </tr>
       <tr>
       <td align="center" class="l-table-edit-td" colspan="4">
			<input type="button" value="保存" class="l-button l-button-test" onclick="doSave();"/>
	   </td>
       </tr>
	</table>
</form>
<script type="text/javascript">
// if has radio,select,checkbox,put here for init
f_initForm();
function f_initForm(){
	//do nothing
}
</script>
</body>
</html>